package com.gsoe.auth.controller;


import com.gsoe.auth.vo.RankingVO;
import com.gsoe.auth.service.UserRankingService;
import com.gsoe.base.model.Result;
import com.gsoe.base.utils.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController

public class RankingController {
    @Autowired
    private UserRankingService userRankingService;

    @GetMapping("/getRanking/{userId}")
    public Result<RankingVO> getRanking(@PathVariable(required = false) Long userId) {
        if(userId == null) {userId=UserUtil.getLoginUser().getId();}
        return Result.success(userRankingService.getRanking(userId));
    }


}
//openFeign